<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="baseUri" value="${pageContext.request.contextPath }"
       scope="request"/>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>图书管理系统</title>
		<link rel="stylesheet" href="${baseUri}/static/layui/css/layui.css">
	</head>
	<body class="layui-layout-body">
		<div class="layui-layout layui-layout-admin">

			<!-- 引入头部导航 -->
			<c:import url="../nav/titlenav.jsp"/>

			<!-- 引入左边导航 -->
			<c:import url="../nav/leftnav.jsp"/>


			<%--中间--%>
			<div class="layui-body">
				<table border="3" style="text-align: center" >
					<tr>
						<th colspan="10" style="font-size: 30px">机电学院</th>
					</tr>
					<tr>
						<th width="70px">编号</th>
						<th width="100px">学号</th>
						<th width="70px">名字</th>
						<th width="50px">性别</th>
						<th width="50px">年龄</th>
						<th width="70px">年级</th>
						<th width="100px">学院</th>
						<th width="280px">借书编号</th>
						<th width="200px">书籍名称</th>
						<th width="300px">编辑</th>
					</tr>
					<c:forEach items="${students}" var="student">
						<tr>
							<td>${student.sid}</td>
							<td>${student.identity}</td>
							<td>${student.name}</td>
							<td>${student.sex}</td>
							<td>${student.age}</td>
							<td>20${student.grade}级</td>
							<td>${student.college}</td>
							<td style="color: red">
								<c:if test="${student.book_id==0}">
									当前没有借阅书籍
								</c:if>
								<c:if test="${student.book_id!=0}">
									${student.book_id}
								</c:if>
							</td>
							<td style="color: red">
								<c:if test="${student.book_title!=null}">
									《${student.book_title}》<br>
								</c:if>
								<c:if test="${student.book_title==null}">
									当前没有借阅书籍
								</c:if>
							</td>
							<td>
								<a type="button" class="layui-btn" href="stuLook?sid=${student.sid}">添加借书信息</a>
								<a type="button" class="layui-btn layui-btn-warm"
								   href="delStuBorrow?sid=${student.sid}&book_id=${student.book_id}">归还图书</a>
							</td>
						</tr>
					</c:forEach>
				</table>
			</div>


			<!-- 引入底部导航 -->
			<c:import url="../nav/bottom.jsp"/>
		</div>


		<script src="${baseUri}/static/layui/layui.js"></script>
		<script>
            //JavaScript代码区域
            layui.use('element', "$", function () {
                var element = layui.element;
                var $ = layui.$;

            });
            layui.use('carousel', function () {
                var carousel = layui.carousel;
                //建造实例
                carousel.render({
                    elem: '#test1',
                    width: '100%' //设置容器宽度
                    ,
                    arrow: 'always' //始终显示箭头
                    //,anim: 'updown' //切换动画方式
                });
            });
		</script>
	</body>
</html>